#!/usr/bin/perl

use CGI;

my $buffer = "aa";
my $len = $ENV{CONTENT_LENGTH} || 0;
read STDIN, $buffer, $len;

my $q = CGI->new();

print $q->header();

print "\n test test \n";

print "content_length:$ENV{CONTENT_LENGTH}\n";
print $q->request_method()." <\n";
print $q->param('foo')." < foo\n";
print $q->param('bar')." < bar\n";

#print "> $ENV{REQUEST_METHOD} \n\n";

print "----------\n";
#my $buffer = "aa";
#my $len = $ENV{CONTENT_LENGTH} || 0;
#read \*STDIN, $buffer, $len;
#read(STDIN, $buffer, $len);
#my $b1 = $q->read_from_client(\$buffer,$len,0);

##read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
#if ($q->request_method() eq 'POST') {
#my @line = <STDIN>;
#print "@line \n post \n";
#
##    read (STDIN,$buffer,$ENV{'CONTENT_LENGTH'});
#} elsif ($q->request_method() eq 'GET') {
#print "\nget\n";
#    $buffer = $ENV{'QUERY_STRING'};
#}
print "$buffer\n:content_length:$ENV{'CONTENT_LENGTH'} \n";
print "----------------------------------\n";
#while(my $line = <STDIN>){
#    print ">$line \n";
#}

